﻿using System;
using ClapackNet;
namespace NumericalSolution {
  class ClapackNetDemo {
    public static void Main() {

      DoubleGeneralMatrix mat = new DoubleGeneralMatrix(3, 3);
      DoubleGeneralMatrix vec = new DoubleGeneralMatrix(3, 1);

      mat[0, 0] = 8.0;
      mat[0, 1] = -1.0;
      mat[0, 2] = -4.0;
      mat[1, 0] = -4.0;
      mat[1, 1] = 1.0;
      mat[1, 2] = 4.0;
      mat[2, 0] = -9.0;
      mat[2, 1] = -6.0;
      mat[2, 2] = 4.0;

      vec[0, 0] = -6.0;
      vec[1, 0] = 10.0;
      vec[2, 0] = -9.0;

      mat.Factorize();
      mat.Solve(vec);

      for (int i = 0; i < 3; i++) {
        Console.WriteLine(vec[i, 0]);
      }
    }
  }
}
